package com.bm.product.service.impl;

import com.bm.product.entity.Carousel;
import com.bm.product.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 木浔
 * @CreateTime: 2025-08-05
 */

@Service
public class CarouselImplService implements CarouselService {

    @Autowired
    MongoTemplate mongoTemplate;

    public List<Carousel> getAllCarousels() {
        return mongoTemplate.findAll(Carousel.class);
    }

    public int insert(Carousel carousel) {
        mongoTemplate.save(carousel);
        return carousel.getId();
    }
}
